<template>
    <view class="globe_back">
        <view class="box">
            <view v-if="payType == 0">
                <u-count-down :time="30 * 60 * 60 * 1000" format="DD:HH:mm:ss" autoStart millisecond @change="onChange">
                    <view class="time fw_bold f_40">
                        待支付，剩余
                        <text class="time__item" style="color: #ff6401">{{ timeData.minutes }}&nbsp;</text>
                        分
                        <text class="time__item" style="color: #ff6401">{{ timeData.seconds }}&nbsp;</text>
                        秒
                    </view>
                </u-count-down>
            </view>
            <view v-if="payType == 1" class="fw_bold f_40">待接单，请耐心等待</view>
            <view v-if="payType == 2" class="fw_bold f_40">已完成，感谢您的使用</view>
            <view class="detailedBox">
                <view class="title">描述照片</view>
                <view class="info"></view>
                <view class="infoImgBox" >
                    <image class="infoimg" v-for="img in info.meta.images" :key="img" :src="$lz.cdn(img,3)" mode="widthFix"></image>
                </view>
            </view>
            <!-- 接单员 -->
            <view v-if="payType == 2" class="flex justify_content_between store">
                <view class="flex">
                    <image class="storeImg" :src="url + 'cqt.png'" mode=""></image>
                    <view>
                        <view class="storeTitle">同路仁接单员</view>
                        <view class="salesVolume"><u-rate :count="count" v-model="value" active-color="#FF6401"
                                inactive-color="#F7F7F7" size="16" gutter="2"></u-rate></view>
                    </view>
                </view>
                <view>
                    <image class="address" :src="url + 'icon_dpdz.png'" mode=""></image>
                    <text class="addressText">电话联系</text>
                </view>
            </view>
            <!-- 金额 -->
            <view class="detailedBox">
                <view class="flex justify_content_between detailed">
                    <view>开锁类型</view>
                    <view>汽车开锁</view>
                </view>
                <view class="flex justify_content_between detailed">
                    <view>服务位置</view>
                    <view>贵阳市南明区解放路255号</view>
                </view>
                <view class="flex justify_content_between detailed">
                    <view>姓名</view>
                    <view>王先生</view>
                </view>
                <view class="flex justify_content_between detailed">
                    <view>联系电话</view>
                    <view>172****2111</view>
                </view>
                <view class="flex justify_content_between detailed">
                    <view>预算报价</view>
                    <view class="fw_bold" style="color: #ff6401">￥3215.02</view>
                </view>
            </view>
        </view>
        <view style="height: 150rpx"></view>
        <!-- 底部 -->
        <view v-if="payType == 0" class="button flex justify_content_between">
            <view class="TotalPrice">
                <view class="f_24">
                    费用：
                    <text style="color: #ff6401; font-size: 32rpx; font-weight: bold">2220.05</text>
                </view>
            </view>
            <view class="buy" @click="buy">立即付款</view>
        </view>
    </view>
</template>

<script>
import { getOrderInfo } from '@/api'
export default {
    data() {
        return {
            type: 0, //服务状态：0租用电池，1上门检修故障
            payType: 0, //支付状态：0待支付，1待接单
            count: 5,
            value: 5,
            timeData: {},
            url: '',
            order_id: 0,
            info: {},
        };
    },
    onShow() {
        this.url = this.baseUrl + this.imgPath;
    },
    onLoad(args) {
        if (args.id) {
            this.order_id = args.id;
            this.info.id = args.id;
            this.handleGetOrderInfo();
        } else {
            this.$u.route({ type: 'back' });
        }
    },
    methods: {
        handleGetOrderInfo() {
            getOrderInfo(this.order_id).then(({ data }) => {
                this.info = data;
            });
        },
        onChange(e) {
            this.timeData = e;
        },
        buy() {
            uni.navigateTo({
                url: '/pages/index/success'
            });
        }
    }
};
</script>

<style scoped lang="scss">
.box {
    padding: 32rpx;

    .addTitle {
        font-size: 40rpx;
        color: #00091a;
        font-weight: bold;
    }

    .addText {
        font-size: 28rpx;
        color: #999ca3;
        margin-top: 16rpx;
    }

    .icon_r {
        width: 32rpx;
        height: 32rpx;
        vertical-align: middle;
        margin-top: 36rpx;
    }

    .address {
        background: white;
        border-radius: 16rpx;
        padding: 24rpx;
    }

    .coupon,
    .detailedBox {
        background: white;
        border-radius: 16rpx;
        padding: 24rpx;
        margin-top: 24rpx;
    }

    .ProductMap {
        width: 200rpx;
        height: 200rpx;
        border-radius: 16rpx;
    }

    .couT {
        width: 30%;
        margin: 16rpx 0;
        color: #333a47;
        font-size: 28rpx;
    }

    .coutext {
        width: 70%;
        padding: 16rpx 0;
        font-size: 28rpx;
        color: #ccced1;
    }

    .couponIcon {
        width: 32rpx;
        height: 32rpx;
        vertical-align: middle;
    }

    .detailed {
        color: #333a47;
        font-size: 28rpx;
        margin-bottom: 32rpx;
    }
}

.button {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 16rpx 32rpx;
    background: #ffffff;

    .buy {
        width: 176rpx;
        height: 76rpx;
        line-height: 76rpx;
        text-align: center;
        color: white;
        border-radius: 8rpx;
        background-image: linear-gradient(to right, #ff924d, #ff6401);
    }
}

.title {
    font-size: 28rpx;
    color: #333a47;
}

.info {
    font-size: 28rpx;
    color: #00091a;
    margin-top: 32rpx;
}

.infoimg {
    width: 140rpx;
    height: 140rpx;
    border-radius: 16rpx;
    margin: 24rpx 12rpx;
}

.store {
    padding: 24rpx;
    background: white;
    border-radius: 24rpx;
    margin-top: 30rpx;
}

.storeImg {
    width: 96rpx;
    height: 96rpx;
    border-radius: 16rpx;
    margin-right: 16rpx;
}

.storeTitle {
    color: #00091a;
    font-size: 32rpx;
    margin-bottom: 8rpx;
}

.address {
    width: 48rpx;
    height: 48rpx;
    display: block;
    margin: 0 auto;
}

.addressText {
    color: #999ca3;
    font-size: 24rpx;
}

.salesVolume {
    color: #999ca3;
    font-size: 28rpx;
}
</style>
